<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/WorkspaceTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="top">
        
    </ui:define>

    <ui:define name="left">
        
    </ui:define>

    <ui:define name="right">
        
    </ui:define>

    <ui:define name="content">
        <style>
            .ui-state-highlight.ui-selected {
                color: blueviolet;
            }
        </style>

        <p:panel style="height: 250px">
            <h2>Select Pending ATP Checking For Simulation</h2>

            <h:form id="viewSFForm">

                <p:ajaxStatus>
                    <f:facet name="start">
                        <h:graphicImage value="./../images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>
                <p:messages showDetail="true" />

                <h:panelGrid columns="3" cellpadding="10">
                    <h:outputLabel for="sfNumber" style="font-weight: bold" value="Enter ATP Checking Id: "/>
                    <h:outputText
                                 id="sfNumber" value="#{aTPSelectManagerBean.pendingStrId}"/>
                    <p:commandButton update="sfForm" oncomplete="sfDialog.show();" image="ui-icon ui-icon-search"/>    
                </h:panelGrid>
                <p:commandButton id="button" value="Select" ajax="false" action="#{aTPSelectManagerBean.redirectToATPForRFQ()}"/>

            </h:form>
        </p:panel>

        <p:dialog header="Search ATP For RFQ" widgetVar="sfDialog" hideEffect="explode" height="600" width="800">
            <h:form id="sfForm">
                <p:dataTable var="sf" value="#{aTPSelectManagerBean.pendingATPForRFQs}" widgetVar="sfTbl"
                             emptyMessage="No ATP Checking found with given criteria" selection="#{aTPSelectManagerBean.selectedATP}" selectionMode="single">

                    <f:facet name="header">
                        <p:outputPanel>
                            <h:outputText value="Search all fields:" />
                            <p:inputText id="globalFilter" onkeyup="sfTbl.filter()" style="width:150px" />
                        </p:outputPanel>
                    </f:facet>

                    <p:column filterBy="#{sf.pendingStrId}" 
                              headerText="Pending ATP" 
                              filterMatchMode="contains">
                        <h:outputText value="#{sf.pendingStrId}" />
                    </p:column>
                    
                    <p:column filterBy="#{sf.type}"
                              headerText="Type" >
                        <h:outputText value="#{sf.type}" />
                    </p:column>
                    
                    <p:column filterBy="#{sf.deliveryOrder.salesQuotation.sqNumber}"
                              headerText="Sales Quotation Number">
                        <h:outputText value="#{sf.deliveryOrder.salesQuotation.sqNumber}"/>
                    </p:column>

                </p:dataTable>
                <p:commandButton value="Select Pending ATP Checking" update="viewSFForm" oncomplete="sfDialog.hide()"/>
            </h:form>
        </p:dialog>
    </ui:define>

    <ui:define name="bottom">
        
    </ui:define>

</ui:composition>
